#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
	int n,k;
	while (cin >> n>>k)
	{
		vector<int>arr(n);
		for (int i = 0; i < n; i++)
		{
			cin >> arr[i]
				;
		}
		sort(arr.begin(), arr.end());
		cout << arr[k-1] << endl;
	}
	return 0;
}
